package com.woniuxy.light_smart.controller;


import com.woniuxy.light_smart.entity.Troops;
import com.woniuxy.light_smart.service.TroopsService;
import com.woniuxy.light_smart.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("troops")
@RestController
public class TroopsController {
    @Autowired
    private TroopsService troopsService;
    @GetMapping("")
    public Result sell(){
        List<Troops> troopsList = troopsService.selectAll();
        if(troopsList!=null){
            return Result.ok().data("list",troopsList);
        }else {
            return Result.error();
        }
    }
}
